<?php 
//1.链接数据库
include '../function.php';

$mysqli = @new mysqli("127.0.0.1","root","","school"); 

if($mysqli->connect_errno){
	exit('错误代码：'.$mysqli->connect_errno."错误信息：".$mysqli->connect_error);
}

$mysqli->query("set names utf8");

// var_dump($mysqli->error);
// var_dump($mysqli->errno);exit;

//4.组sql
$sql = "insert into stu (name,age) values('小小xxx','20')";
$sql = "select * from stusss";

$res = $mysqli->query($sql);


//6.通过结果集取数据
$tempArr = [];
while ($row = $res->fetch_array(MYSQLI_ASSOC)) {
	$tempArr[]=$row;
}

var_dump($tempArr);

$res->free();

$mysqli->close();

// var_dump($mysqli->connect_errno);

// var_dump($mysqli->connect_error);















 ?>